package jellis.android.hellotabwidget;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TabHost;
import android.widget.TextView;

public class Agenda extends TabActivity {
	public void onCreate(Bundle savedInstanceState) {
		Log.d(this.toString(),"Hoi Agenda.");
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.main);

	    Resources res = getResources(); // Resource object to get Drawables
	    TabHost tabHost = getTabHost();  // The activity TabHost
	    TabHost.TabSpec spec;  // Resusable TabSpec for each tab
	    Intent intent;  // Reusable Intent for each tab
	    final Viewer a = new Viewer();

	    // Do the same for the other tabs
	    intent = new Intent().setClass(this, Planner.class);
	    spec = tabHost.newTabSpec("albums").setIndicator("Planner",
	                      res.getDrawable(R.drawable.ic_tab_albums))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    intent = new Intent().setClass(this, Viewer.class);
	    spec = tabHost.newTabSpec("songs").setIndicator("Viewer",
	                      res.getDrawable(R.drawable.ic_tab_songs))
	                  .setContent(intent);
	    tabHost.addTab(spec);
	    	    
	    tabHost.setCurrentTab(0);
	    
	    getTabWidget().getChildAt(1).setOnClickListener(new OnClickListener() {
	        @Override
	        public void onClick(View v) {
	            if (getTabHost().getCurrentTabTag().equals("Viewer")== false) {
	                getTabHost().setCurrentTab(1);
	                //a.fillData();
	            }
	        }
	    });

	}
}